#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define APPAY_LEN 20

int main()
{
    //生成随机数
    int num[APPAY_LEN] = {}, a[APPAY_LEN] = {};
    char ch[APPAY_LEN], ch1[APPAY_LEN];
    for (int i = 0; i < APPAY_LEN; i++)
    {
        num[i] = rand() % 100 + 50;
        a[i] = num[i];
    }
    for(int i=0;i<APPAY_LEN;i++) printf("%d ",num[i]);
    printf("\n");
    int t;
    //冒泡排序
    for (int j = 0; j < APPAY_LEN; j++)
    {
        for (int i = 0; i < APPAY_LEN - j - 1; i++)
        {
            if (num[i] > num[i + 1])
            {
                t = num[i];
                num[i] = num[i + 1];
                num[i + 1] = t;
            }
        }
    }
    //去重，去除非字母
    for (int i = 0; i < APPAY_LEN; i++)
    {
        if (num[i] >= 65 && num[i] <= 90 || num[i] >= 97 && num[i] <= 122)
        {
            ch[i] = num[i];
        }
        else
        {
            ch[i] = 0;
            num[i] = 0;
        }
    }
    for (int i = 0; i < APPAY_LEN; i++)
    {
        printf("%d ", num[i]);
    }
    printf("\n");
    //大写转小写
    for (int i = 0; i < APPAY_LEN; i++)
    {
        if (ch[i] >= 'A' && ch[i] <= 'Z')
        {
            ch[i] += 32;
        }
    }
    for (int i = 0; i < APPAY_LEN; i++)
    {
        printf("%c", ch[i]);
    }
    printf("\n");
    //去除位置上0
    for (int i = 0, j = 0; i < APPAY_LEN; i++)
    {
        if (ch[i] != '\0')
        {
            ch1[j] = ch[i];
            j++;
        }
    }

    for (int i = 1; i < APPAY_LEN; i++)
    {
        if (ch1[i - 1] == ch1[i])
        {
            ch1[i - 1] = '\0';
        }
    }
    //去除相同的后排序
    for (int i = 0; i < APPAY_LEN; i++)
    {
        for (int j = 0; j < APPAY_LEN-i-1; j++)
        {
            if (ch1[j] > ch1[j+1])
            {
                int temp = ch1[j];
                ch1[j] = ch1[j+1];
                ch1[j+1] = temp;
            }
        }
    }
    int d=0;
    for(int i=0;i<APPAY_LEN;i++){
        if(ch1[i]>='a'&&ch1[i]<='z'){

        }else{
            d++;
        }
    }
    int g;
    for(int i=d;i<APPAY_LEN;i++){
        printf("%c",ch1[i]);
    }
    //查找
    for (int i = 1; i <= 5; i++)
    {
        scanf("%d", &g);
        printf("%c ", ch1[g+d-1]);
    }
    return 0;
}